package com.py.product.service.impl;

import java.util.List;

import com.py.product.domain.SysDictData;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.py.product.mapper.ProductTypeMapper;
import com.py.product.domain.ProductType;
import com.py.product.service.IProductTypeService;

/**
 * 货品类型Service业务层处理
 * 
 * @author he
 * @date 2024-11-21
 */
@Service
public class ProductTypeServiceImpl implements IProductTypeService 
{
    @Autowired
    private ProductTypeMapper productTypeMapper;

    /**
     * 查询货品类型
     * 
     * @param productTypeId 货品类型主键
     * @return 货品类型
     */
    @Override
    public ProductType selectProductTypeByProductTypeId(Long productTypeId)
    {
        return productTypeMapper.selectProductTypeByProductTypeId(productTypeId);
    }

    /**
     * 查询货品类型列表
     * 
     * @param productType 货品类型
     * @return 货品类型
     */
    @Override
    public List<ProductType> selectProductTypeList(ProductType productType)
    {
        return productTypeMapper.selectProductTypeList(productType);
    }

    /**
     * 新增货品类型
     * 
     * @param productType 货品类型
     * @return 结果
     */
    @Override
    public int insertProductType(ProductType productType)
    {
        productType.setCreateTime(DateUtils.getNowDate());
        return productTypeMapper.insertProductType(productType);
    }

    /**
     * 修改货品类型
     * 
     * @param productType 货品类型
     * @return 结果
     */
    @Override
    public int updateProductType(ProductType productType)
    {
        productType.setUpdateTime(DateUtils.getNowDate());
        return productTypeMapper.updateProductType(productType);
    }

    /**
     * 批量删除货品类型
     * 
     * @param productTypeIds 需要删除的货品类型主键
     * @return 结果
     */
    @Override
    public int deleteProductTypeByProductTypeIds(Long[] productTypeIds)
    {
        return productTypeMapper.deleteProductTypeByProductTypeIds(productTypeIds);
    }

    /**
     * 删除货品类型信息
     * 
     * @param productTypeId 货品类型主键
     * @return 结果
     */
    @Override
    public int deleteProductTypeByProductTypeId(Long productTypeId)
    {
        return productTypeMapper.deleteProductTypeByProductTypeId(productTypeId);
    }

    @Override
    public List<ProductType> selectTypeListAll() {
        return productTypeMapper.selectTypeListAll();
    }

    @Override
    public List<ProductType> findParent(String parentId) {
        return productTypeMapper.findParent(parentId);
    }

    @Override
    public List<SysDictData> selectAllByDictType(String dictType) {
        return productTypeMapper.selectAllByDictType(dictType);
    }
}
